<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib  uri="/WEB-INF/tlds/authorizetag.tld" prefix="px"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加会员</title>
<link href="/admin/public/bootstrap.min.css" title="" rel="stylesheet" />
<link href="/admin/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="/admin/public/animate.css" rel="stylesheet">
<link rel="stylesheet" href="/admin/public/inspinia.css" />
<link rel="stylesheet" href="/admin/css/pop-up.css" />
<link rel="stylesheet" href="/admin/css/plugins/toastr/toastr.min.css" />
<link rel="stylesheet" type="text/css" href="${request.getContext }/admin/css/xcConfirm.css"/>
  <!-- 开关控件样式 -->
<link rel="stylesheet" href="${request.getContext }/admin/css/plugins/switchery/switchery.css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
	<script src="/admin/public/html5shiv.min.js"></script>
	<script src="/admin/public/respond.min.js"></script>
<![endif]-->
<style type="text/css">
.img{
	height: 130px;
	width:180px;
}
</style>
</head>
<body>
	<div id="wrapper" class="container">
		<div class="wrapper wrapper-content">
			<div class="right_box">
				<div style="border: none; box-shadow: none;" class="right_one row">
					<div class="col-md-12 col-sm-12 col-xs-12" style="float: left;">
						<form class="form-horizontal" method="post" id="biao" enctype="multipart/form-data"
							novalidate="novalidate">
							<!-- <input type="hidden" name="receiptlogId" id="receiptlogId" value="">
							<input type="hidden" name="contractId" id="contractId" value=""> -->
							<div class="form-group">
								<label class="col-lg-2 control-label">姓名:</label>
								<div class="col-lg-6">
									<input type="text" id="realname" name="realname" class="form-control"  />
								</div>
							</div>
							<!-- 头像图片上传 -->
							<div class="form-group">
								<label class="col-lg-2 control-label">头像:</label>
								<div class="col-lg-6">
									<input type="file" id="userUrl" name="userUrl" class="form-control" onchange="preview(this,1)" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label"></label>
								<div class="col-lg-6">
									<div id="preview1">
										<img src="${userUrl }" alt="" />
									</div>
								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">性别:</label>
								<div class="col-lg-9" style="margin-top: 5px;">
						            <input type="radio" name="sex" value="0"/>&nbsp;女&nbsp;&nbsp;&nbsp;&nbsp;
						            <input type="radio" name="sex" value="1"/>&nbsp;男&nbsp;&nbsp;&nbsp;&nbsp;
                                    <span class="field-validation-valid" data-valmsg-for="Title" data-valmsg-replace="true"></span>
                                </div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">手机号/电话:</label>
								<div class="col-lg-6">
									<input   type="text" id="telenumber" name="telenumber" class="form-control" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">推荐人:</label>
								<div class="col-lg-6">
									<input type="text" id="name" name="name" class="form-control" />
								</div>
							</div>
							<div class="form-group">
								<label class="col-lg-2 control-label">备注:</label>
								<div class="col-md-6">
									<textarea class="form-control" name="remark" rows="" cols=""></textarea>
								</div>
							</div>
								<input type="hidden" id="checkTF" value="0">
								<input type="button" onclick="savePact();" id="btnn" style="width:82px;height:34px; display:none; margin-left: 12px"  value="保存"   class="col-lg-3 btn btn-success"/>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="/admin/public/jquery-1.11.3.js"></script>
	<script src="/admin/public/bootstrap.min.js" type="text/javascript"></script>
	<script src="${request.getContext }/admin/js/xcConfirm.js" type="text/javascript" charset="utf-8"></script>
	<script src="/admin/js/plugins/toastr/toastr.min.js"></script>
	<script src="/admin/js/new_page.js"></script>
	<script src="/admin/js/jquery.form.min.js"></script>
</body>
<script type="text/javascript">
		function preview(file, i) {
			var prevDiv = document.getElementById('preview' + i);
			if (file.files && file.files[0]) {
				var reader = new FileReader();
				reader.onload = function(evt) {
					prevDiv.innerHTML = '<img class="img" src="' + evt.target.result + '" />';
				}
				reader.readAsDataURL(file.files[0]);
			} else {
				prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
			}
		}
	</script>
<script>
 //添加会员信息
function savePact(){
	$('#biao').ajaxSubmit({
	       url:"/admin/Member/addMe",
	       data:$('#bookInfo').serialize(),
	       type:"post",
	       enctype:"multipart/form-data",
	       dataType:"json",
	       success:function(data){
	    	   $('#ifr',window.parent.document).attr('src','/admin/Member/mlist');
	       },
	       error:function(data){
	    	   alert("请上传正确的图片！");
	       }
	    });
} 
</script>
</html>